#include "menu.h"
#include "start.h"
#include "ui_menu.h"
#include <vector>
int playernum;
int botnum;
std::vector<int> team(5);
std::vector<int> playerTeam;
std::vector<int> botTeam;
menu::menu(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::menu)
{
    ui->setupUi(this);

}

menu::~menu()
{
    delete ui;
}

void menu::on_back_clicked()
{
    this->hide();
    emit backtostart();
}

void menu::menushow()
{
    this->show();
}

void menu::on_apply_clicked()
{
    playernum=0;
    botnum=0;
    int whoplay[5];
    whoplay[0]=ui->player1->currentIndex();
    whoplay[1]=ui->player2->currentIndex();
    whoplay[2]=ui->player3->currentIndex();
    whoplay[3]=ui->player4->currentIndex();
    whoplay[4]=ui->player5->currentIndex();

    team[0]=ui->team1->currentText().toInt();
    team[1]=ui->team2->currentText().toInt();
    team[2]=ui->team3->currentText().toInt();
    team[3]=ui->team4->currentText().toInt();
    team[4]=ui->team5->currentText().toInt();
    for(int i=0;i<5;i++)
    {
        if(whoplay[i]==1)
        {
            playernum++;
            playerTeam.push_back(team[i]);
        }
        if(whoplay[i]==2)
        {
           botnum++;
           botTeam.push_back(team[i]);
        }
    }
}
